package com.ruoyi.web.controller.warning;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.warning.domain.entity.Vminfo;
import com.ruoyi.warning.domain.query.VminfoQuery;
import com.ruoyi.warning.domain.vo.VminfoVO;
import com.ruoyi.warning.mapper.VminfoMapper;
import com.ruoyi.warning.service.IVminfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author chenhc
 * @since 2025-08-19
 */
@RestController
@RequestMapping("/vminfo")
@Api(tags = "虚拟机配置", description = "用于处理虚拟机配置相关操作的控制器")
public class VminfoController {
    @Resource
    private IVminfoService iVminfoService;
    @Resource
    private VminfoMapper vminfoMapper;
    @ApiOperation("分页")
    @Log(title = "分页查询", businessType = BusinessType.SELECT)
    //@PreAuthorize("@ss.hasPermi('system:config:export')")
    @GetMapping(value = "/page")
    public R<TableDataInfo> page(VminfoQuery query)
    {
        Page<Vminfo> page = PageHelper.startPage(query.getPageNum(),query.getPageSize());
        List<VminfoVO> list = vminfoMapper.list(query);
        return R.ok(new TableDataInfo(list, page.getTotal()));
    }

}
